package com.jcli.jb51_net.article._获取屏幕中颜色;

import java.awt.Color;
import java.util.LinkedList;
import java.util.Queue;

public class ColorHistory {
    private Queue<Color> colors;
    private final int maxSize;

    public ColorHistory(int maxSize) {
        this.colors = new LinkedList<>();
        this.maxSize = maxSize;
    }

    public void addColor(Color color) {
        if (colors.size() >= maxSize) {
            colors.poll();
        }
        colors.offer(color);
    }

    public Queue<Color> getColors() {
        return colors;
    }
}
